import 'package:dk_flutter_base/dk_ui.dart';
import 'package:dk_flutter_module_sale/r.dart';

class SearchBarWidget extends StatelessWidget {
  final String placeholder;
  final VoidCallback tapAction;
  SearchBarWidget({this.placeholder,this.tapAction});
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(left: 12,right: 12,top: 4,bottom: 4),
      height: 44,
      color: Color(0xFFF7F8F9),
      child: GestureDetector(
        onTap: this.tapAction,
        child: Container(
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius:BorderRadius.all(Radius.circular(2)),
          ),
          child: Row(
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.only(left: 10,right: 5),
                child: buildSearchImage(context),
              ),
              Expanded(
                child: Text(this.placeholder,style: TextStyle(color: Color(0xFF999999),fontSize: 14),overflow: TextOverflow.ellipsis,),
              )
            ],
          ),
        ),
      ),
    );
  }
  Widget buildSearchImage(BuildContext context) {
    return Image.asset(
      R.imagesCommonSearchGlassPng,
      height: 11,
      width: 11,
    );
  }
}
